<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jsArray对象</title>
</head>
<body>
<script>
  //声明
  var arr = [1,"a",true,[i,2,3],{name:"zahngsan",age:"18"},null];
  var arr2 = new Array(1,2,3,4);

  //赋值
  arr[10]=100;
  console.log(arr[10]);

  //遍历
  for (var i = 0; i < arr.length; i++) {
    console.log(arr[i]);
  }

  for(var temp of arr){
      console.log(temp);
  }
  for(var temp in arr){//表示下标
      console.log(arr[temp]);
  }

  arr.forEach(function (value,index){
      console.log(value,index);
  })
  var fun = function (value,index){
      console.log(value,index);
  }//或 var fun =(a,b) =>console.log(a,b);
  arr.forEach(fun);

  //属性与方法

</script>
</body>
</html>